package net.ojbk.study.curriculumDesign.beans.cilentservicer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/1/6
 * Time: 18:06
 * Description: No Description
 */
public class Servicer {
    private String uid;
    private String name;
    private int status;
    private double divScore;
    private int servicedSum;
    /**
     * 此属性表中没有
     */
    private List<Chat> sChatList;

    /* 以下 为功能区 */

    public void cutChat(Chat chat) throws Exception{
        if (sChatList.indexOf(chat) == -1)
            throw new Exception("此客服没有此会话");
        chat.catChat();
        this.sChatList.remove(chat);
    }

    public void sendMsgToUserChat(Chat chat, ChatMessage chatMessage) throws Exception{
        if (this.sChatList.indexOf(chat) == -1)
            throw new Exception("此客服没有此会话");
        chat.sendMsgToUser(chatMessage);
    }

    public void joinChat(Chat chat) {
        System.out.println("sChatList.add(chat);");
        if (this.sChatList == null) {
            this.sChatList = new ArrayList<Chat>();
        }
        sChatList.add(chat);
    }

    public void removeChat(Chat chat) {
        sChatList.remove(chat);
    }

    public Servicer() {
    }

    public Servicer(String uid, String name, int status, double divScore) {
        this.uid = uid;
        this.name = name;
        this.status = status;
        this.divScore = divScore;
    }

    public List<Chat> getsChatList() {
        return sChatList;
    }

    public void setsChatList(List<Chat> sChatList) {
        this.sChatList = sChatList;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getServicedSum() {
        return servicedSum;
    }

    public void setServicedSum(int servicedSum) {
        this.servicedSum = servicedSum;
    }

    public double getDivScore() {
        return divScore;
    }

    public void setDivScore(double divScore) {
        this.divScore = divScore;
    }

    @Override
    public String toString() {
        return "Servicer{" +
                "uid='" + uid + '\'' +
                ", name='" + name + '\'' +
                ", status=" + status +
                ", divScore=" + divScore +
                '}';
    }
}
